package com.kr.aia.powerrp.common;

import java.io.File;
import java.lang.reflect.Field;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.widget.ImageButton;
import android.widget.Toast;

public class commonUtil extends Activity{
	
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
	}
	
	public void makeDisabledButton(ImageButton iBtn, boolean disabledYN){
		if(disabledYN){
			iBtn.setEnabled(false);
			iBtn.setAlpha(0.2f);
		}else{
			iBtn.setEnabled(true);
            iBtn.setAlpha(1.0f);
		}
	}

    public boolean isDirectory(String dataPath){
		if(checkSDMount()){
			File dir = new File(dataPath);
			if(!dir.exists()) {
				dir.mkdirs();
				return false;
			}
		}
		return true;
		//Log.i("PRP", path);
	}
    
	
	public boolean checkSDMount(){
		Boolean isSDPresent = android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED);

		if(isSDPresent){
			//Toast toast = Toast.makeText(getContext(), "SD카드가 삽입 되었습니다.", Toast.LENGTH_SHORT); 
			//toast.show();
			return true;
		}else{
			Toast toast = Toast.makeText(getApplicationContext(), "SD카드가 삽입되지 않았습니다.", Toast.LENGTH_SHORT); 
			toast.show();
			return false;
		}
	}
}
